'use strict';
var even_group_calculate_average = function(collection){
    let arr=collection.filter(
        function filtered(element,index,array){
            return index%2!==0;
        }
    );
    let arr1=arr.filter(
        function filtered1(element){
            return element%2===0;
        }
    );
    let arr2=[];
    if(arr1.length===0){
        arr2.push(0);
    }
    else {
        let arr3=arr1.sort(
            function sorted(a,b){
                return a-b;
            }
        );
        if(arr3[0]>=100){
            let i=arr3.reduce(
                function reduced(a,b){
                    return a+b;
                }
            );
            arr2.push(i/arr3.length);
        }
        else {
            let arr4=[],arr5=[],arr6=[];
            for(let i of arr3){
                if(i<10){
                    arr4.push(i);
                }
                else if(i<100){
                    arr5.push(i);
                }
                else {
                    arr6.push(i);
                }
            }
            let j=arr4.reduce(
                function reduced1(a,b){
                    return a+b;
                }
            );
            arr2.push(j/arr4.length);
            let k=arr5.reduce(
                function reduced2(a,b){
                    return a+b;
                }
            );
            arr2.push(k/arr5.length);
            let l=arr6.reduce(
                function reduced3(a,b){
                    return a+b;
                }
            );
            arr2.push(l/arr6.length);
        }
    }
    return arr2;
};
module.exports = even_group_calculate_average;
